<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@include file="../common/jspcommon.jsp"%>
<%@include file="../common/jscss.jsp"%>
<script type="text/javascript" src="/thirdparty/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
	var grid_ae = null;
	var dialog_ae = null;
	$(function(){
		grid_ae = $("#order_grid").ligerGrid({
				//checkbox: true,
				title : '产品订单列表',
                columns: [
				{ display: "订单号", name: 'id',width:100,height:50},
                { display: "订购人", name: 'contactor',width:80},
                { display: "订购详情", name: 'orderDetail',width:400},
                { display: '订单状态', name: 'statusName',width:80},
                { display: '订单数量', name: 'totalAmount',width:80},
                { display: '订单总额(元)', name: 'totalFee',width:80,
                	render:function(value){
                		return "￥"+value.totalFee;
                	},
                	totalSummary:{
                		render:function(suminf,column,cell){
                			return'总计 '+suminf.sum+"元"+"<br>最大"+suminf.max+"元";
                		}
                	}
                },
                { display: "订购日期", name: 'orderTime',width:80},
                { display: "联系电话", name: 'phone',width:100}
                ], 
                pageSize:20,
                root :'list',
                record:'totalRecord',
                url: "/misc/order/companyordergrid.htm?type=03", 
                width: '99%',height:'99%',
                onAfterShowData:function(){
                	$(".l-grid-row-cell-inner").css("height","auto");
                }
            });


	});

	
	function search(){
		var companyName=$("#companyName").val();
		var company="";
		if(companyName!="" && companyName!=null){
			company=$("#company").val();
		}
		grid_ae.options.parms = [{name:'beginDate',value:$("#beginDate").val()},{name:'endDate',value:$("#endDate").val()},{name:'company',value:company}];
		grid_ae.loadData();
	}
	
	function downLoadExcel(){
		var url="/misc/order/exportexcel.htm?orderType=03&company=${company}";
		var beginDate=$("#beginDate").val();
		if(beginDate!=""){
			url+="&beginDate="+beginDate;
		}
		var endDate=$("#endDate").val();
		if(endDate!=""){
			url+="&endDate="+endDate;
		}
		window.location.href=url;
	}
</script>
<div id="searchbar">
	<table>
		<tr style="font-size: 12px">
			<td>下单时间查找范围：从<input name="date" id="beginDate" type="text" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,highLineWeekDay:true,isShowOthers:true})"/></td>
			<td>到：<input name="date" id="endDate" type="text" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,highLineWeekDay:true,isShowOthers:true})"/></td>
			<sec:authorize ifNotGranted="ROLE_COMPANY" >
			<td>公司:</td>
			<td><%@include file="../company/companyName.jsp"%></td>
			</sec:authorize>
			<td><input id="btnOK" type="button" value="查询" onclick="search()" /></td>
	    	<!-- <td><a href="javascript:void(0)" id="dl_a" onclick="downLoadExcel();">下载excel</a></td> -->
		</tr>
	</table>
</div>
<div id="order_grid" style="margin:0; padding:0"></div>
